package de.koller.reason.gui.renderObj;

import de.koller.oceanFramework.glyph.GlyphRendererGL;
import de.koller.oceanFramework.glyph.GlyphScreenGL;
import de.koller.oceanFramework.tree.Child;
import de.koller.reason.RSea;
import de.koller.reason.gui.textureObj.IPart;
import de.koller.reason.resource.ResourceUtil;

public class GlyphRendering extends RSea {

	@Child private final GlyphScreenGL screen = ResourceUtil.createGlyphScreen( 512, 512 );

	public GlyphScreenGL getScreen() {
		return screen;
	}
	
	public GlyphRendererGL getRenderer() {
		return screen.getRenderer();
	}
	
	public static boolean isOverlapped( IPart p1, IPart p2 ) {
		if( p1.getSubX() > p2.getSubX() + p2.getSubWidth() )
			return false;
		if( p1.getSubY() > p2.getSubY() + p2.getSubHeight() )
			return false;
		if( p1.getSubX() + p1.getSubWidth() < p2.getSubX() )
			return false;
		if( p1.getSubY() + p1.getSubHeight() < p2.getSubY() )
			return false;
		return true;
	}
	
}
